package com.weatherstation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weatherstation.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Optional;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    
    @Select("SELECT * FROM user WHERE username = #{username} AND is_deleted = 0")
    User findByUsername(@Param("username") String username);
    
    @Select("SELECT COUNT(*) FROM user WHERE username = #{username}")
    int existsByUsername(@Param("username") String username);
} 